#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int cmp(const void* n1, const void* n2)
{
	return *(int*)n1 - *(int*)n2;
}
int main()
{
	int n = 0;
	scanf("%d", &n);
	int arr[105] = { 0 };

	int i = 0;
	for (i = 0; i < n; i++)
	{
		scanf("%d", arr + i);
	}

	qsort(arr, n, sizeof(int), cmp);

	int count = 0;
	for (i = 2; i < n; i++)
	{
		int j = 0;
		for (j = 0; j < i - 1; j++)
		{
			int q = 0;
			for (q = j + 1; q < i; q++)
			{
				if (arr[i] == arr[j] + arr[q])
				{
					count++;
					goto A;
				}
			}
		}
	A:;
	}
	printf("%d", count);
	return 0;
}
